#ifndef _BUTILITIES_HEADER_
#define _BUTILITIES_HEADER_
#include <time.h>
#include <sys/time.h>
#include <iostream>
#include <BDefs.h>
using namespace std;
namespace blueberry
{
	class BPerfTiming
	{
	private:
		struct timeval tv_Start, tv_End;
	public:
		inline void markStart()
		{
			gettimeofday(&tv_Start,NULL);
		}
		inline void markEnd()
		{
			gettimeofday(&tv_End, NULL);
		}
		inline void printTimeElapsed()
		{
			double dSec = tv_End.tv_sec - tv_Start.tv_sec;
			double dUSec = tv_End.tv_usec - tv_Start.tv_usec;
			dSec *= 1000000;
			dUSec += dSec;
			cout << "Start Time=" << tv_Start.tv_sec << "." << tv_Start.tv_usec << endl;
			cout << "Start Time=" << tv_End.tv_sec << "." << tv_End.tv_usec << endl;
			cout << "Time Elapsed=" << dUSec << endl;
		}

	};
}
#endif

